package com.dingyh.shopwebbackground.service.impl;

import com.dingyh.shopwebbackground.entity.Evaluate;
import com.dingyh.shopwebbackground.mapper.EvaluateMapper;
import com.dingyh.shopwebbackground.service.EvaluateService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author dingyuhan
 * @since 2023-02-20
 */
@Service
public class EvaluateServiceImpl extends ServiceImpl<EvaluateMapper, Evaluate> implements EvaluateService {

    @Autowired
    EvaluateMapper evaluateMapper;

    public List<Evaluate> allEvaluate(Map<String,Object> map){
        return evaluateMapper.allEvaluate(map);
    }

    public List<Evaluate> allEvaluateByCompany(Map<String,Object> map){
        return evaluateMapper.allEvaluateByCompany(map);
    }

    public boolean addSaleContent(Evaluate evaluate){
        try{
            return updateById(evaluate);
        }catch (Exception e){
            System.out.println(e);
            return false;
        }
    }

    public boolean removeEvaluate(String id){
        try {
            return removeById(id);
        }catch (Exception e){
            System.out.println(e);
            return false;
        }
    }

    @Override
    public Evaluate selectByOrderId(String orderid) {
        return evaluateMapper.selectByOrderId(orderid);
    }
}
